const TerserPlugin = require('terser-webpack-plugin');

module.exports = {
  productionSourceMap: false,
  chainWebpack: config => {
    config
      .plugin('html')
      .tap(args => {
        args[0].title = '广东省中山市质量计量监督检测所'
        return args
      })
  },
  configureWebpack: (config) => {
    if (process.env.NODE_ENV === 'production') {
      config.optimization.minimizer = [
        new TerserPlugin({
          terserOptions: {
            compress: {
              drop_console: true, // 生产环境中移除 console
            },
          },
        }),
      ];
    }
  },
};
